<div class="menu">
	<div align="right" style="font-weight:bold; font-size:12px; padding-bottom:8px; color:#10498A;">
		<?php echo $this->Access->getMyRole($this->Access->getMy('group_id')).": ".$this->Access->getMy('nombre_completo');?>
	</div>
	<div class="desplegable">
		<?php  $this->Form->new_menu($this->Access->getMy('id'),$this->Access->getMy('group_id'));?>
	</div>
</div>
<div class="planeaciones form">
<?php echo $this->Form->create('Planeacione');?>
	<fieldset>
 		<legend><?php __('Editando Actividad'); ?></legend>
 		<h4><?php //echo "Usuario: ".$users[$user_id]; ?></h4>
 		
 		<?php 			
 			$grupo_usuario = $this->User->getMy($this->Form->value('Planeacione.user_id'),'group_id');
 			$observacion_activa=false; $eliminar = false;
 			if($group_id==$grupo_usuario){ // Estoy viendo mi calendario
 				$campos_aprobacion = false;
 				$disable=false;
 				$eliminar = true;
 				if($this->Form->value('Planeacione.estado')!="Programado"){
 					$observacion_activa=true;
 				}
 			}else{
 				$campos_aprobacion = true;
 				$disable=true; 				
 			} 			
 		?> 		
 		<table>
 			<tr>
 				<td><?php echo $this->Form->input('event_date',array('label'=>'Fecha de la actividad', 'disabled'=>$disable));?></td>
 				<td class="actions_2">
 				<?php 
 					if($eliminar){ 				
	 					$id = $this->Form->value('Planeacione.id');
	 					$tipo = $this->Form->value('Planeacione.tipo_actividad');
	 					echo $this->Html->link(__('Eliminar', true), array('action' => 'delete', $id), null, sprintf(__('Quiere eliminar esta actividad: %s?', true), $tipo));
	 					echo $this->Html->link(__('Regresar', true), array('action' => 'calendar'));
 					}else{
 						$anio = substr($this->Form->value('Planeacione.event_date'),0,4);
						$mes = substr($this->Form->value('Planeacione.event_date'),5,2);
 						echo $this->Html->link(__('Regresar', true), array('action' => 'calendar', $anio, $mes, $this->Form->value('Planeacione.user_id')));
 					}  
 				?>
 				</td>	  
 			</tr>
 			<tr>
 				<td><?php echo $this->Form->input('tipo_actividad',array('disabled'=>$disable));?></td>
 				<td><?php 
 						echo $this->Form->label('Actores');
 						echo $this->Form->input('circulos_aprendizaje_id', array( 'type' => 'select', 'options'=>$circulosAprendizajes, 'selected'=>$actores_activos, 'multiple' => true, 'disabled'=>$disable));
					?>
 			</tr>
 			<tr> 				
 				<td><?php echo $this->Form->input('enfasis',array('disabled'=>$disable));?></td>
 				<td><?php echo $this->Form->input('descripcion',array('disabled'=>$disable));?></td>
 			</tr>
 			<tr>
 				<td><?php echo $this->Form->input('recursos',array('disabled'=>$disable));?></td>
 				<td><?php echo $this->Form->input('resultados_esperados',array('disabled'=>$disable));?></td>
 			</tr>
 	<?php 
 		if($observacion_activa){
 			?>
 			<tr> 		
 				<td colspan="2"><?php echo $this->Form->input('observacion',array('disabled'=>true));?></td>
 			</tr>
 			<?php echo $this->Form->input('estado', array('type'=>'hidden', 'value'=>'Programado')); ?>	
 			<?php 
 		} 			
		if($campos_aprobacion){
			?>
			<tr>
				<td><?php echo $this->Form->input('estado');?></td>
				<td><?php echo $this->Form->input('observacion');?></td>
			</tr>
			<?php 
			//Usuario aprobador
			echo $this->Form->input('user_aprobador_id', array('type'=>'hidden', 'value'=>$user_id));
			echo $this->Form->input('circulos_aprobados', array('type'=>'hidden', 'value'=>$circulos_aprobados));
			echo $this->Form->input('fecha', array('type'=>'hidden', 'value'=>$this->Form->value('Planeacione.event_date')));
			echo $this->Form->input('editando', array('type'=>'hidden', 'value'=>true));			
		}
	?>
	</table>
	</fieldset>
<?php echo $this->Form->input('id', array('type'=>'hidden', 'value'=>$this->Form->value('Planeacione.id'))); ?>
<?php echo $this->Form->input('user_id', array('type'=>'hidden', 'value'=>$this->Form->value('Planeacione.user_id'))); ?>
<?php echo $this->Form->end(__('Guardar', true));?>
</div>